import request from '@/utils/request';

async function getPreAuth(file) {
    const response = await request('/api/resource/public/oss/producePutPreSignUrls', {
        method: 'POST',
        data: { sysCode: 'OA', fileNames: [file.name] }
    });
    const { data: signResult, code } = response;
    if (code === 10000) {
        console.log('预授权成功：', signResult);
        const { keyName } = signResult[0];
        return keyName;
    }
    return '';
}

export default getPreAuth;
